package com.aios.dao;

import com.aios.entity.SystemUserPassword;
import com.aios.entity.SystemUserPasswordExample;
import com.aios.entity.mapper.ExpirePassword;

import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

public interface SystemUserPasswordMapper {

	int countByExample(SystemUserPasswordExample example);
	int deleteByExample(SystemUserPasswordExample example);
	int deleteByPrimaryKey(Integer id);
	int insert(SystemUserPassword record);
	int insertSelective(SystemUserPassword record);

	List<SystemUserPassword> selectByExample(SystemUserPasswordExample example);
	SystemUserPassword selectByPrimaryKey(Integer id);

	int updateByExampleSelective(@Param("record") SystemUserPassword record,
			@Param("example") SystemUserPasswordExample example);
	int updateByExample(@Param("record") SystemUserPassword record,
			@Param("example") SystemUserPasswordExample example);
	int updateByPrimaryKeySelective(SystemUserPassword record);
	int updateByPrimaryKey(SystemUserPassword record);
	//int insertWithoutId(@Param("record") SystemUserPassword record);
	int insertWithoutId(SystemUserPassword record);
	
	@Select("SELECT SYSTEM_USER_ID,PASSWORD_CHANGE_DATE,LAST_ALERT_DATE,(SELECT DATEDIFF(now(),PASSWORD_CHANGE_DATE)) as NUMBER_OF_DAYS FROM system_user_password  WHERE (SELECT DATEDIFF(now(),PASSWORD_CHANGE_DATE))>=#{expireTargetDay}")
    @ResultMap(value ="MiniResultMap")
	List<ExpirePassword> findByExpireDate(@Param("expireTargetDay") int expireTargetDay);
}